package com.qf.admin.controller;


import com.qf.common.http.Result;
import com.qf.dto.Admin;
import com.qf.po.LoginAdmin;
import com.qf.service.impl.FunctionService;
import com.qf.vo.Function;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class IndexController {

    @Resource
    private FunctionService functionService;

    @RequestMapping("index")
    public String toIndex(){

        return "index";
    }

    /*@RequestMapping("func-list")
    @ResponseBody
    public List<Function> toFunc(Admin admin){

       List<Function> functions = functionService.queryFunction(admin.getId());

        return functions;
    }*/
    @RequestMapping("func-list")
    @ResponseBody
    public Result<List<Function>> getModuleList(LoginAdmin loginAdmin) {
        return Result.success(functionService.queryFunction(loginAdmin.getId()));
    }

}
